<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>登录界面</title>
  <link rel="stylesheet" href="./css/style.css">
  <link rel="stylesheet" href="./css/body.css">
  <script src="./jquery.js"></script>
  <script src="./axios.js"></script>
  <script src="./index-axios.js"></script>
</head>

<body>
  <div class="container">
    <section id="content">
      <form>
        <h1>账号登录</h1>
        </h1>
        <div>
          <i class="close">X</i>
          <input type="text" name="username" placeholder="用户名" id="username">
        </div>
        <div>
          <i class="close">X</i>
          <input type="password" name="password" placeholder="密码" id="password">
        </div>
        <div>
          <input type="submit" value="登录" class="btn btn-primary" id="js-btn-login">
          <a href="../03-pwdBaseCode/index.html">忘记密码?</a>
          <a href="../02-regbaseCode/reg.html">注册账号</a>
        </div>
      </form>
    </section>
  </div>
</body>

<script>
  addEventListener
  /*接口地址： http://124.223.14.236:3001/api */
  // $(function () {
  //   // const username = $('#username').val().trim()
  //   // const password = $('#password').val().trim()
  //   $('form').on('submit', function (e) {
  //     e.preventDefault()
  //     const data = $(this).serialize()
  //     console.log(data);
  //     $.ajax({
  //       type: 'POST',
  //       url: 'http://124.223.14.236:3001/api/user/login',
  //       data,
  //       success: function (res) {
  //         console.log(res);
  //         if (!res.success) return console.log(res.msg);
  //         localStorage.setItem('token', res.data.token)
  //         alert('登陆成功')
  //       }
  //     })


  //   })
  // })

</script>

</html>